package P4.T07;

public class Util {
    public static double triangleArea(int a, int b, int c) throws TriangleException {
        if(a<0||b<0||c<0)throw new TriangleException(AngleError.EdgeLenErrorNeg,a,b,c);
        if(a+b<=c||a+c<=b||b+c<=a)throw new TriangleException(AngleError.EdgeLenErrorRule,a,b,c);
        double s=(a+b+c)/2.0;
        return 1/2.0*Math.sqrt(s*(s-a)*(s-b)*(s-c));
    }
}
